Defining data structures
Introduction
For building add-ons upon existing applications, it is possible to develop
using an existing database. If a new project is started, it is recommended
to define data structures in Java syntax and generate an arbitrary database
out of these database neutral instructions.
Approach
See samples like e.g. de.jugs.cookbook.DoCookbook.
Each of these DataObject
extending classes represents a table in the database.
-
tableName is the name of the table
-
AbstractAttribute[] attributes is the list of the table columns,
defining description, column names, type and length
-
Index[] indices are the index definition to optimize the access
time
Class mkt.TableCreator is
a sample for how to create tables dynamically when an empty database is
found. It is extending de.must.dataobj.TableCreatorStd.
Class de.jugs.cookbook.DbScriptCreator
is a sample for how to create a script to create a MySQL dialect.
However this is done, the principal is to define the database inside
the application and then use it freely and expandable.
Attribute types (column types)
See Index and
IndexItem
for how to define indices.
© Copyright 2001-2004 Christoph
Müller, Kärntner Str. 56, D-70469 Stuttgart, Germany, http://www.must.de